package org.at;

import java.math.BigDecimal;

public class Mango extends Fruit{
    // 成熟度
    private String ripeness;

    // 甜度
    private String sweetness;

    public Mango(BigDecimal price, BigDecimal discountRate, String ripeness, String sweetness) {
        if (discountRate.compareTo(BigDecimal.ZERO) <=0  || discountRate.compareTo(BigDecimal.ONE) > 0) {
            throw new IllegalArgumentException("折扣必须在0到1区间");
        }
        this.name = "芒果";
        this.price = price;
        this.discountRate = discountRate;
        this.ripeness = ripeness;
        this.sweetness = sweetness;
    }

    @Override
    public String getDescription() {
        return String.format("香甜可口的%s,成熟度%s,甜度%s",name,ripeness,sweetness);
    }

    public String getRipeness() {
        return ripeness;
    }

    public void setRipeness(String ripeness) {
        this.ripeness = ripeness;
    }

    public String getSweetness() {
        return sweetness;
    }

    public void setSweetness(String sweetness) {
        this.sweetness = sweetness;
    }
}
